Resolves conflicts between the local and the server copies of a shared document.
expression.ResolveConflict(SyncConflictResolution)
expression Required. An expression that returns a Sync object.
SyncConflictResolution Required MsoSyncConflictResolutionType.
MsoSyncConflictResolutionType can be one of these soSyncConflictResolutionType constants. |
msoSyncConflictClientWins (0) |
msoSyncConflictServerWins (1) |
msoSyncConflictMerge (2) |
Use the ResolveConflict method to resolve differences between the local copy of the active document and the server copy. Use the msoSyncConflictMerge option (not available for a Microsoft Excel Workbook) to merge the changes from each document into the other. Replace the server copy with local changes by using the msoSyncConflictClientWins option, or replace the local copy with the changed server copy by using the msoSyncConflictServerWins option.
The msoSyncConflictMerge option merges changes made to the server copy into the local copy, but does not actually resolve the conflict. In order to resolve the conflict with the merged changes winning, you must save the active document after merging changes, then call the ResolveConflict method again with the msoSyncConflictClientWins option.
The ResolveConflict method can encounter a conflict condition if the client is unaware of recent changes to the server copy of the shared document. Call the GetUpdate method before calling ResolveConflict to refresh the status of the server copy and to detect a possible conflict.
The ResolveConflict method raises a run-time error if the local document has unsaved changes or if no conflict exists between the 2 copies of the document.
Not all document synchronization problems raise trappable run-time errors. After performing an operation using the Sync object, it's a good idea to check the Status property; if the Status property is msoSyncStatusError, check the ErrorType property for additional information on the type of error that has occurred.
The following example attempts to resolve a conflict by merging changes between the local and the server copies of the active document.
Dim objSync As Office.Sync
Dim strStatus As String
Set objSync = ActiveDocument.Sync
If objSync.Status = msoSyncStatusConflict Then
objSync.ResolveConflict msoSyncConflictMerge
ActiveDocument.Save
objSync.ResolveConflict msoSyncConflictClientWins
strStatus = "Conflict resolved by merging changes."
MsgBox strStatus, vbInformation + vbOKOnly, "Sync Information"
End If
Set objSync = Nothing